package com.ruipeng.shengyapo.service.impl;

import com.ruipeng.shengyapo.dao.BikeMapper;
import com.ruipeng.shengyapo.dao.CustomerMapper;
import com.ruipeng.shengyapo.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Created by tu_pei on 17/5/31.
 */

@Service
public class CustomerServiceImpl implements CustomerService{

    @Autowired
    private CustomerMapper customerMapper;
    @Autowired
    private BikeMapper bikeMapper;

    @Override
    public int addBikeError(Map<String, Object> params)  {
        int count = customerMapper.addBikeError(params);
        if(count>0){
            params.put("lockState","0");
            count += bikeMapper.updateBikeStatusByBikeId(params);
            return count;
        }else{
            return 0;
        }
    }

    @Override
    public int addBikeOpenError(Map<String, Object> params) {
        return customerMapper.addBikeOpenError(params);
    }

    /**
     * 退款逾期未到账
     *
     * @param params
     * @return
     */
    @Override
    public int addRefundComplaint(Map<String, Object> params) {
        return customerMapper.addRefundComplaint(params);
    }
}
